<?php
/** 初始化项目 */
require '../../app/app.php';
/** 初始化数据库 */
use app\util\Mysql;
$database = Mysql::init();

if (isset($_SESSION['username']) && $_SESSION['username'] != "") {
    $out = array('code' => '0', "msg" => "", "count" => "", "data" => ""); //定义返回数组
    $o=0;
    for($i=1;$o==0;$i++){
        $test=$database->select("text_main",["textname"],["textid"=>$i]);
        if($test[0]==null){
            $out['data']=$i;
            $out['msg']="获取成功";
            $o=1;
        }
    }
    echo json_encode($out);
} else {
    $out = array('code' => '1', "msg" => "请先登录", "count" => "", "data" => ""); //定义返回数组
    echo json_encode($out);
}
?>

